package com.deyuanyun.pic.settings.controller.dto.org;

import com.alibaba.fastjson.annotation.JSONField;
import com.deyuanyun.pic.common.util.StringUtils;

/**
 *  公司信息展示DTO
 *  @author axiao(xj08.dream@gmail.com)
 *  @date 2016-11-09
 *  @version 1.0
 *  Histroy: [修改人][时间][描述]
 */
public class CompanyDTO {

    private String id;

    private String shortName;//公司短名

    private String name; //公司名

    private String code;//公司编号

    private String tel; //公司电话

    private String createRemark; //创建备注

    private Short state; //是否启用：0，启用；1，停用

    private String parentId; //父节点ID

    private String parentIdName; //父级节点名字

    private String createUser;//创建用户

    private String cityFlag;//province-city-county

    private String city;

    private String province;

    private String county;

    private String logoPath;//公司logo路径

    private String attachmentId; //附件id

    public String getCity() {
        String[] s = getCountys();
        if(s.length == 3) {
            return s[1];
        }
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getProvince() {
        String[] s = getCountys();
        if(s.length == 3) {
            return s[0];
        }
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    @JSONField(serialize = false)
    public String[] getCountys(){
        if(StringUtils.isNotEmpty(this.cityFlag)) {
            return this.cityFlag.split("-");
        }
        return null;
    }

    public String getCounty() {
        String[] s = getCountys();
        if(s.length == 3) {
            return s[2];
        }
        return county;
    }

    public void setCounty(String county) {
        this.county = county;
    }

    public String getName() {
        return name;
    }

    public CompanyDTO setName(String name) {
        this.name = name;
        return this;
    }

    public String getCityFlag() {
        return cityFlag;
    }

    public void setCityFlag(String cityFlag) {
        this.cityFlag = cityFlag;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getShortName() {
        return shortName;
    }

    public void setShortName(String shortName) {
        this.shortName = shortName;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getTel() {
        return tel;
    }

    public void setTel(String tel) {
        this.tel = tel;
    }

    public String getCreateRemark() {
        return createRemark;
    }

    public void setCreateRemark(String createRemark) {
        this.createRemark = createRemark;
    }

    public Short getState() {
        return state;
    }

    public void setState(Short state) {
        this.state = state;
    }

    public String getParentId() {
        return parentId;
    }

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    public String getParentIdName() {
        return parentIdName;
    }

    public void setParentIdName(String parentIdName) {
        this.parentIdName = parentIdName;
    }

    public String getCreateUser() {
        return createUser;
    }

    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }

    public String getLogoPath() {
        return logoPath;
    }

    public void setLogoPath(String logoPath) {
        this.logoPath = logoPath;
    }

    public String getAttachmentId() {
        return attachmentId;
    }

    public void setAttachmentId(String attachmentId) {
        this.attachmentId = attachmentId;
    }
}
